package com.example.weather.job;

import com.example.weather.service.RedisService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;

import java.util.Date;

@Component
public class CacheWeatherDataJob {
    @Autowired
    RedisService redisService;

    //定时任务
    @Scheduled(cron = "0 0 0 * * ?")
    public void cacheWeatherData(){
        System.out.println("----------------定时任务被调用-----------------"+new Date());
        redisService.cacheWeatherData();
    }
}
